using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;

namespace cs2335.CCT
{
    public interface ISpriteStore
    {
        Sprite Sprite { get; }
        void setSprite(String filename);
    }
    public class SpriteStore
    {
        Sprite sprite;
        
        public Sprite Sprite
        {
            get { return sprite; }
            //set { name = value; }
        }
        public void setSprite(String filename)
        {
            //System.Console.WriteLine(filename);
            Point p = new Point(0,0);
            if (sprite!= null)
                 p = sprite.Location;
             if (sprite == null)
             {
                 sprite = new Sprite(filename);
             }
            sprite.Image = new Bitmap(System.Drawing.Image.FromFile(filename));

            sprite.Location = p;
            sprite.Invalidate();
            //System.Console.WriteLine(sprite.ToString());
        }
        
        private ArrayList spriteList;
        
        public SpriteStore()
        {
            spriteList = new ArrayList();
        }

        public void Add(String filename)
        {
            spriteList.Add(filename);
        }
        public void Remove (String filename)
        {
            spriteList.Remove(filename);
        }
    }
}
